<template>
  <el-dialog :title="title" :visible="visible" @update:visible="$emit('update:visible', $event)">
    <my-form ref="form" :labels="labels" :record="record" />
    <span slot="footer" class="dialog-footer">
      <el-button @click="$emit('update:visible', false)">取 消</el-button>
      <el-button type="primary" @click="ok">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import MyForm from '../myForm'

export default {
  components: {
    MyForm
  },
  props: {
    title: {
      type: String,
      default: '编辑'
    },
    visible: {
      type: Boolean,
      default: false
    },
    labels: {
      type: Object,
      default() {
        return {}
      }
    },
    record: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  methods: {
    ok() {
      this.$refs.form.submit(record => this.$emit('ok', record))
    }
  }
}
</script>

<style>
</style>
